import axios from 'axios';

const DEEPSEEK_API_KEY = 'sk-80aed5abc9f746a6bb6b4cdf7f61fdef'; // API密钥

const deepseekApi = axios.create({
  baseURL: process.env.VUE_APP_API_SERVICE,

  headers: {
    'Authorization': `Bearer ${DEEPSEEK_API_KEY}`,
    'Content-Type': 'application/json'
  }
});

export const getDeepseekResponse = async (prompt) => {

  try {
    const response = await deepseekApi.post('', {
      model: "deepseek-reasoner", // 推理模型
      messages: [{ role: "user", content: prompt }],
      stream:true,//如果设置为 True，将会以 SSE（server-sent events）的形式以流式发送消息增量。消息流以 data: [DONE] 结尾。
    });
    return response.data.choices[0].message.content;
  } catch (error) {
    console.error('API Error:', error.response?.data || error.message);
    return null;
  }
};
